<template>
	<!-- 注意：微信小程序中，组件中不允许使用标签选择器 -->
	<view class="go-top" @click="go">
		<uni-icons type="arrow-up" size="60rpx"></uni-icons>
	</view>
</template>

<script>
	export default {
		methods: {
			go(){
				//返回页面顶部
				uni.pageScrollTo({
					scrollTop: 0,		//滚动到页面顶部的位置
					duration: 200,		//滚动动画耗时多久
				})
			}
		}
	}
</script>

<!-- uni-app中所有的组件/页面中编写的样式都是只针对当前组件生效的 -->
<!-- 即uni-app中scoped可以省略 -->
<style lang="scss">
.go-top {
	position: fixed;
	right: $uni-spacing-row-base;
	bottom: $uni-spacing-col-lg * 7;
	background-color: #fff;
	border: $uni-border-width  $uni-border-style  $uni-border-color;
	box-shadow: 0 0 $uni-shadow-radius-base;
	border-radius: $uni-border-radius-circle;
	opacity: $uni-opacity-half;
	&:active {
		opacity: 1;
	}
}
</style>